package Stream_Study.comprehensive;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test1 {
    public static void main(String[] args) {
        /*
            定义一个集合，并添加一些整数1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            过滤掉奇数,只留下偶数
            并将结果保存起来
         */

        ArrayList<Integer> list = new ArrayList<>();
        Collections.addAll(list,1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

        List<Integer> odds = list.stream().filter(i -> i % 2 == 0).toList();
        System.out.println(odds);
    }
}
